/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AnimationTest.java
 *
 * Created on Oct 29, 2009, 11:12:16 AM
 */
package GeneralTesting;

import java.util.Timer;

/**
 *
 * @author Heather
 */
public class AnimationTest extends javax.swing.JApplet
{

  /** Initializes the applet AnimationTest */
  public void init()
  {
    try
    {
      java.awt.EventQueue.invokeAndWait(new Runnable()
      {

        public void run()
        {
          initComponents();
          timer.scheduleAtFixedRate(t, 10, interval);
        }
      });
    } catch (Exception ex)
    {
      ex.printStackTrace();
    }
  }

  /** This method is called from within the init() method to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    container = new javax.swing.JPanel();
    button = new javax.swing.JButton();

    container.setBackground(new java.awt.Color(204, 204, 255));

    button.setText("move!");
    button.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        buttonActionPerformed(evt);
      }
    });

    javax.swing.GroupLayout containerLayout = new javax.swing.GroupLayout(container);
    container.setLayout(containerLayout);
    containerLayout.setHorizontalGroup(
      containerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(containerLayout.createSequentialGroup()
        .addGap(25, 25, 25)
        .addComponent(button, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addContainerGap(491, Short.MAX_VALUE))
    );
    containerLayout.setVerticalGroup(
      containerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, containerLayout.createSequentialGroup()
        .addContainerGap(344, Short.MAX_VALUE)
        .addComponent(button, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addGap(22, 22, 22))
    );

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    );
  }// </editor-fold>//GEN-END:initComponents

  private void buttonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_buttonActionPerformed
  {//GEN-HEADEREND:event_buttonActionPerformed
    // TODO add your handling code here:
    System.out.println("YEEEEHAAAAA!");
    t.cancel();
  }//GEN-LAST:event_buttonActionPerformed

  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JButton button;
  private javax.swing.JPanel container;
  // End of variables declaration//GEN-END:variables
  private Timer timer = new Timer();
  private long interval = 60;
  ATimer t = new ATimer(this);

  /**
   * @return the button
   */
  public javax.swing.JButton getButton()
  {
    return button;
  }

  /**
   * @return the container
   */
  public javax.swing.JPanel getContainer()
  {
    return container;
  }
}
